package com.allen.imsystem.user.model.param;

import com.allen.imsystem.common.Const.GlobalConst;
import com.allen.imsystem.user.model.pojo.UserInfo;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

@Data
public class EditUserInfoParam {

    private String uid;

    private String email;

    @Length(min = 1, max = 12, message = "用户名格式错误")
    private String username;

    @Length(min = 1, max = 30, message = "个性签名长度应在1到30个字符")
    private String signWord;

    private Integer gender;

    private Integer age;

    private String avatar;

    public EditUserInfoParam() {
    }

    public EditUserInfoParam(String email, UserInfo userInfo) {
        this.email = email;
        this.uid = userInfo.getUid();
        this.age = userInfo.getAge();
        this.avatar = GlobalConst.Path.AVATAR_URL + userInfo.getAvatar();
        this.username = userInfo.getUsername();
        this.signWord = userInfo.getDesc();
        this.gender = userInfo.getGender();
        this.age = userInfo.getAge();
    }
}
